<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%--<%@ taglib prefix="s" uri="/struts-tags" %>--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
    <meta name="description" content=""/>
    <meta name="author" content=""/>
    <title></title>
    <!--favicon-->
    <link rel="icon" href="assets/images/favicon.ico" type="image/x-icon">
    <!-- simplebar CSS-->
    <link href="assets/plugins/simplebar/css/simplebar.css" rel="stylesheet"/>
    <!-- Bootstrap core CSS-->
    <link href="assets/css/bootstrap.min.css" rel="stylesheet"/>
    <!--Data Tables -->
    <link href="assets/plugins/bootstrap-datatable/css/dataTables.bootstrap4.min.css" rel="stylesheet" type="text/css">
    <link href="assets/plugins/bootstrap-datatable/css/buttons.bootstrap4.min.css" rel="stylesheet" type="text/css">
    <!-- animate CSS-->
    <link href="assets/css/animate.css" rel="stylesheet" type="text/css"/>
    <!-- Icons CSS-->
    <link href="assets/css/icons.css" rel="stylesheet" type="text/css"/>
    <!-- Sidebar CSS-->
    <link href="assets/css/sidebar-menu.css" rel="stylesheet"/>
    <!-- Custom Style-->
    <link href="assets/css/app-style.css" rel="stylesheet"/>


</head>

<body>
<div id="container-fluid" class="container-fluid">
    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-header"><i class="fa fa-table"></i> 实训任务表</div>
                <div class="card-body">
                    <div class="table-responsive">
                        <table id="example" class="table table-bordered">

                            <thead>
                            <b>
                                <tr>
                                    <th style="width: 20px;">任务编号</th>
                                    <th style="width: 20px;">课程名</th>
                                    <th style="width: 15px;">开始时间</th>
                                    <th style="width: 15px;">结束时间</th>
                                    <th style="width: 30px;">任务名</th>
                                    <th style="width: 30px;">操作</th>
                                </tr>
                            </b>
                            </thead>
                            <tbody>
                            <!--描述：表开始 -->
                            <c:forEach items="${list}" var="task">
                                <tr>
                                    <td>${task.taskId}</td>
                                    <td>${task.course.cname}</td>
                                    <td>${task.startDate}</td>
                                    <td>${task.endDate}</td>
                                    <td>
                                        <a href="./taskdoc?id=${task.taskId}">${task.tname}</a>
                                    </td>
                                    <td style="width: 0px;;">
                                        <div style="width: 1px;">
                                            <a href="./findtask?id=${task.taskId}">
                                                <button class="btn btn-primary btn-lg waves-effect waves btn-sm"
                                                        data-toggle="modal" data-target="#myModal">修改
                                                </button>
                                            </a>
                                            <button type="button" class="btn btn-warning waves-effect waves btn-sm"
                                                    style="margin: 0px auto; " onclick="sweet('${task.taskId}')">
                                                删除
                                            </button>
                                        </div>
                                    </td>
                                </tr>
                            </c:forEach>

                            <!--	描述：表结束 -->
                            </tbody>

                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div><!-- End Row-->


</div>


<!-- Bootstrap core JavaScript-->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/popper.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>

<!-- simplebar js -->
<script src="assets/plugins/simplebar/js/simplebar.js"></script>
<!-- sidebar-menu js -->
<script src="assets/js/sidebar-menu.js"></script>

<!-- Custom scripts -->
<script src="assets/js/app-script.js"></script>

<!--Data Tables js-->
<script src="assets/plugins/bootstrap-datatable/js/jquery.dataTables.min.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/dataTables.bootstrap4.min.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/dataTables.buttons.min.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/buttons.bootstrap4.min.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/jszip.min.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/pdfmake.min.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/vfs_fonts.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/buttons.html5.min.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/buttons.print.min.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/buttons.colVis.min.js"></script>

<!--Sweet Alerts -->
<script src="assets/plugins/alerts-boxes/js/sweetalert.min.js"></script>


<script>
    function sweet(data) {
        swal({
            title: "您确定吗?",			//弹出标题
            text: "该操作会删除该任务信息!",			//弹出文本
            icon: "warning",				//警告图标   还有success error  info  不填就是不显示，默认不显示
            buttons: true,
            dangerMode: true,
        })
            .then((willDelete) => {
                if (willDelete) {
                    swal("任务信息已删除!", {
                        icon: "success",
                    });

                    window.location.href = "delCTask?taskId=" + data; 	//直接跳转到首页
                    //嵌成果方法
                } else {
                    swal("任务信息删除失败!");
                    //嵌失败方法
                }
            });
    }

    function CkPro(id) {
        document.getElementById(id).remove();
    }
</script>


</body>
</html>
